package leetcode_day._2022._202208._1120;

/**
 * 1450. 在既定时间做作业的学生人数
 * 差分
 *
 * @author yzh
 * @version 1.0
 * @date 2022/8/20 20:44
 */
public class _19 {

    public int busyStudent(int[] startTime, int[] endTime, int queryTime) {
        int[] c = new int[1010];
        for (int i = 0; i < startTime.length; i++) {
            c[startTime[i]]++;
            c[endTime[i] + 1]--;
        }
        for (int i = 1; i <= queryTime; i++) c[i] += c[i - 1];
        return c[queryTime];
    }

}
